package nf.model;

import java.io.Serializable;

import java.sql.Timestamp;

import java.util.List;

import javax.annotation.Generated;

import javax.ejb.Stateful;

import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.EmbeddedId;
import javax.persistence.Id;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Version;

@SequenceGenerator(name = "SEQUENCE", sequenceName = "SEQ_GEN")
@Entity
@NamedQueries( { @NamedQuery(name = "Subject.findAll", query = "select o from Subject o"),
        @NamedQuery(name = "Subject.findByName", query = "select o from Subject o where o.name like :name") })
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "Subject")

public class Subject implements Serializable {
  @Column(name = "Name", nullable = false)
  private String name;
  @Column(name = "Created", nullable = false)
  private Timestamp created;
  
  @Id
  @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_GEN")
  private Long id;
  
  @Version
  @Column(name = "Version",nullable = false)
  private Long version;
  
  public Subject() {
    this.created = new Timestamp(System.currentTimeMillis());
  }

  public Subject(String name) {
    this.name = name;
    this.created = new Timestamp(System.currentTimeMillis());
  }
  
  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public Timestamp getCreated() {
    return created;
  }

  public void setCreated(Timestamp created) {
    this.created = created;
  }

  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public Long getVersion() {
    return version;
  }

  public void setVersion(Long version) {
    this.version = version;
  }
}
